package com.hzqy.web.ac.epg;

import java.util.Map;

public class productID {
	//少儿
	private final static int[] kidsAll = {100088,90401270,90315025,90401272,
			701003,701007,701020,701021,711002,711004,90315443,90315444,90316080,
			701008,701010,701009,701031,701028};

	//电影
	private final static int[] movieAll  = {100095,90312853,711010,
			701016,701017,701018,701026,700033,700053,700031,700032,700033,
			90400714,90400722,90400745,90400744,90400748,90400747,
			90312852,90314661,90314662,90314663,90314761};

	//电视剧
	private final static int[] serialAll = {100096,90311418,711011,90312029,90400784,90400772,90400796,90400802,90400749,90400759,
			711012,711013,701011,701012,701019,701025,700020,700045,700039,700040,711003,
			711001,90312030,90312395,90312394,71304360,90315442,90315445,90311417};
	
	//影视剧
	private final static int[] tvMovAll = {100097,100106,711014,90311621,90310360,660001,90400840,90400845,
			90400846,90400841,90400842,90400843,90400844,90400847,90400850,
			90400851,90400911,90400857,90317640,90317641,90317642,
			711015,711016,701013,701014,701015,701024,701027,701030,701029,
			700038,700037,700036,90314664,90314665,90314672,90313041,90310361,
			90311381,90311586,90312321};
	
	//合家欢100107,701032
	private final static int[] filmAll = {100107,701032};
	
	//益智魔方
	private final static int[] magicMouth = {500009};
	
	/**
	 * 返回用户可抽奖次数！！！！！！
	 */
	public static Object getCount(Map<String,String> map) {
		//少儿次数
		int kidsNum = countNum(map,kidsAll,2);
		//电影次数
		int mvNum = countNum(map,movieAll,2);
		//电视剧次数
		int tvNum = countNum(map,serialAll,2);
		//影视剧次数
		int tvMovNum = countNum(map,tvMovAll,7);
		//合家欢次数
		int fimlNum = countNum(map,filmAll,7);
		//益智魔方次数
		int yzmfNum = countNum(map,magicMouth,2);
		
		int result = kidsNum + mvNum + tvNum + tvMovNum + fimlNum + yzmfNum +1;
		return result;
	}
	
	private static int countNum(Map<String,String> map,int[] products,int num) {
		int result = 0;
		boolean flag = true;
		for(int i=0;i<map.size();i++) {
			for(int j=0;j<products.length;j++) {
				if(String.valueOf(products[j]).equals(map.get("product_"+i))) {
					flag = false;
					result = num;
					break;
				}
			}
			if(!flag) {
				break;
			}
		}
		return result;
	}
	
}
